<?php

namespace App\Models;

use App\Models\Contract\SerializeDatetime;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class GroupMember extends Model
{
    use HasFactory, SerializeDatetime;

    protected $fillable = [
        'group_id', 'leader_id', 'user_id', 'type', 'joined_at'
    ];

    public function group()
    {
        return $this->belongsTo(Group::class, 'group_id');
    }

    public function leader()
    {
        return $this->belongsTo(User::class, 'leader_id');
    }

    public function member()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
